remove the reset of first_sel_changed, as after the first popup the
authorKristian Rietveld <kris@gtk.org>
Mon, 13 Oct 2003 19:07:34 +0000 (19:07 +0000)
committerKristian Rietveld <kristian@src.gnome.org>
Mon, 13 Oct 2003 19:07:34 +0000 (19:07 +0000)
Mon Oct 13 21:01:43 2003  Kristian Rietveld  <kris@gtk.org>

* gtk/gtkentrycompletion.c (gtk_entry_completion_popup): remove
the reset of first_sel_changed, as after the first popup the treeview
will always have a row selected and will thus not focus_to_cursor.

* gtk/gtkentry.c (keyval_is_cursor_move): new function to determine
whether the keyval should move the completion selection cursor (used
to avoid ending up with extreme cluttered code), also added
all KP_ equivalents of the keys here,
(gtk_entry_completion_key_press): Keynav tweaks based on comments
from Dave Bordoley and Marco Pesenti Gritti; add the -1 state
as possible current selection, implement Home/End keys, modified
the down key to stop cycling. Maybe page up/down should be implemented
at some later time.

ChangeLog
ChangeLog.pre-2-10
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
gtk/gtkentry.c
gtk/gtkentrycompletion.c

index dd5c55170243c92e93117b44f959868bafbb516a..968952d8ab75098ceb5c0d4f149c57d920167552 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+Mon Oct 13 21:01:43 2003  Kristian Rietveld  <kris@gtk.org>
+
+       * gtk/gtkentrycompletion.c (gtk_entry_completion_popup): remove
+       the reset of first_sel_changed, as after the first popup the treeview
+       will always have a row selected and will thus not focus_to_cursor.
+
+       * gtk/gtkentry.c (keyval_is_cursor_move): new function to determine
+       whether the keyval should move the completion selection cursor (used
+       to avoid ending up with extreme cluttered code), also added
+       all KP_ equivalents of the keys here,
+       (gtk_entry_completion_key_press): Keynav tweaks based on comments
+       from Dave Bordoley and Marco Pesenti Gritti; add the -1 state
+       as possible current selection, implement Home/End keys, modified
+       the down key to stop cycling. Maybe page up/down should be implemented
+       at some later time.
+
 Mon Oct 13 20:58:07 2003  Matthias Clasen  <maclas@gmx.de>
 
        * gdk/x11/gdkwindow-x11.c (gdk_window_set_icon): Make it work 
index dd5c55170243c92e93117b44f959868bafbb516a..968952d8ab75098ceb5c0d4f149c57d920167552 100644 (file)
@@ -1,3 +1,19 @@
+Mon Oct 13 21:01:43 2003  Kristian Rietveld  <kris@gtk.org>
+
+       * gtk/gtkentrycompletion.c (gtk_entry_completion_popup): remove
+       the reset of first_sel_changed, as after the first popup the treeview
+       will always have a row selected and will thus not focus_to_cursor.
+
+       * gtk/gtkentry.c (keyval_is_cursor_move): new function to determine
+       whether the keyval should move the completion selection cursor (used
+       to avoid ending up with extreme cluttered code), also added
+       all KP_ equivalents of the keys here,
+       (gtk_entry_completion_key_press): Keynav tweaks based on comments
+       from Dave Bordoley and Marco Pesenti Gritti; add the -1 state
+       as possible current selection, implement Home/End keys, modified
+       the down key to stop cycling. Maybe page up/down should be implemented
+       at some later time.
+
 Mon Oct 13 20:58:07 2003  Matthias Clasen  <maclas@gmx.de>
 
        * gdk/x11/gdkwindow-x11.c (gdk_window_set_icon): Make it work 
index dd5c55170243c92e93117b44f959868bafbb516a..968952d8ab75098ceb5c0d4f149c57d920167552 100644 (file)
@@ -1,3 +1,19 @@
+Mon Oct 13 21:01:43 2003  Kristian Rietveld  <kris@gtk.org>
+
+       * gtk/gtkentrycompletion.c (gtk_entry_completion_popup): remove
+       the reset of first_sel_changed, as after the first popup the treeview
+       will always have a row selected and will thus not focus_to_cursor.
+
+       * gtk/gtkentry.c (keyval_is_cursor_move): new function to determine
+       whether the keyval should move the completion selection cursor (used
+       to avoid ending up with extreme cluttered code), also added
+       all KP_ equivalents of the keys here,
+       (gtk_entry_completion_key_press): Keynav tweaks based on comments
+       from Dave Bordoley and Marco Pesenti Gritti; add the -1 state
+       as possible current selection, implement Home/End keys, modified
+       the down key to stop cycling. Maybe page up/down should be implemented
+       at some later time.
+
 Mon Oct 13 20:58:07 2003  Matthias Clasen  <maclas@gmx.de>
 
        * gdk/x11/gdkwindow-x11.c (gdk_window_set_icon): Make it work 
index dd5c55170243c92e93117b44f959868bafbb516a..968952d8ab75098ceb5c0d4f149c57d920167552 100644 (file)
@@ -1,3 +1,19 @@
+Mon Oct 13 21:01:43 2003  Kristian Rietveld  <kris@gtk.org>
+
+       * gtk/gtkentrycompletion.c (gtk_entry_completion_popup): remove
+       the reset of first_sel_changed, as after the first popup the treeview
+       will always have a row selected and will thus not focus_to_cursor.
+
+       * gtk/gtkentry.c (keyval_is_cursor_move): new function to determine
+       whether the keyval should move the completion selection cursor (used
+       to avoid ending up with extreme cluttered code), also added
+       all KP_ equivalents of the keys here,
+       (gtk_entry_completion_key_press): Keynav tweaks based on comments
+       from Dave Bordoley and Marco Pesenti Gritti; add the -1 state
+       as possible current selection, implement Home/End keys, modified
+       the down key to stop cycling. Maybe page up/down should be implemented
+       at some later time.
+
 Mon Oct 13 20:58:07 2003  Matthias Clasen  <maclas@gmx.de>
 
        * gdk/x11/gdkwindow-x11.c (gdk_window_set_icon): Make it work 
index dd5c55170243c92e93117b44f959868bafbb516a..968952d8ab75098ceb5c0d4f149c57d920167552 100644 (file)
@@ -1,3 +1,19 @@
+Mon Oct 13 21:01:43 2003  Kristian Rietveld  <kris@gtk.org>
+
+       * gtk/gtkentrycompletion.c (gtk_entry_completion_popup): remove
+       the reset of first_sel_changed, as after the first popup the treeview
+       will always have a row selected and will thus not focus_to_cursor.
+
+       * gtk/gtkentry.c (keyval_is_cursor_move): new function to determine
+       whether the keyval should move the completion selection cursor (used
+       to avoid ending up with extreme cluttered code), also added
+       all KP_ equivalents of the keys here,
+       (gtk_entry_completion_key_press): Keynav tweaks based on comments
+       from Dave Bordoley and Marco Pesenti Gritti; add the -1 state
+       as possible current selection, implement Home/End keys, modified
+       the down key to stop cycling. Maybe page up/down should be implemented
+       at some later time.
+
 Mon Oct 13 20:58:07 2003  Matthias Clasen  <maclas@gmx.de>
 
        * gdk/x11/gdkwindow-x11.c (gdk_window_set_icon): Make it work 
index 7385b991d2347106150f385b0aa3655b5085fab1..7576d72872a1790e134d5e3e3d66286c37163347 100644 (file)
@@ -4511,6 +4511,24 @@ gtk_entry_completion_timeout (gpointer data)
   return FALSE;
 }
 
+static inline gboolean
+keyval_is_cursor_move (guint keyval)
+{
+  if (keyval == GDK_Up || keyval == GDK_KP_Up)
+    return TRUE;
+
+  if (keyval == GDK_Down || keyval == GDK_KP_Down)
+    return TRUE;
+
+  if (keyval == GDK_Home || keyval == GDK_KP_Home)
+    return TRUE;
+
+  if (keyval == GDK_End || keyval == GDK_KP_End)
+    return TRUE;
+
+  return FALSE;
+}
+
 static gboolean
 gtk_entry_completion_key_press (GtkWidget   *widget,
                                 GdkEventKey *event,
@@ -4527,24 +4545,33 @@ gtk_entry_completion_key_press (GtkWidget   *widget,
   if (completion->priv->actions)
     actions = gtk_tree_model_iter_n_children (GTK_TREE_MODEL (completion->priv->actions), NULL);
 
-  if (event->keyval == GDK_Up || event->keyval == GDK_Down)
+  if (keyval_is_cursor_move (event->keyval))
     {
       GtkTreePath *path = NULL;
 
-      if (event->keyval == GDK_Up)
+      if (event->keyval == GDK_Up || event->keyval == GDK_KP_Up)
         {
           completion->priv->current_selected--;
-          if (completion->priv->current_selected < 0)
-            completion->priv->current_selected = 0;
+          if (completion->priv->current_selected < -1)
+            completion->priv->current_selected = -1;
         }
-      else
+      else if (event->keyval == GDK_Down || event->keyval == GDK_KP_Down)
         {
           completion->priv->current_selected++;
           if (completion->priv->current_selected >= matches + actions)
-            completion->priv->current_selected = 0;
+            completion->priv->current_selected = matches + actions;
         }
+      else if (event->keyval == GDK_Home || event->keyval == GDK_KP_Home)
+        completion->priv->current_selected = -1;
+      else if (event->keyval == GDK_End || event->keyval == GDK_KP_End)
+        completion->priv->current_selected = matches + actions - 1;
 
-      if (completion->priv->current_selected < matches)
+      if (completion->priv->current_selected < 0)
+        {
+          gtk_tree_selection_unselect_all (gtk_tree_view_get_selection (GTK_TREE_VIEW (completion->priv->tree_view)));
+          gtk_tree_selection_unselect_all (gtk_tree_view_get_selection (GTK_TREE_VIEW (completion->priv->action_view)));
+        }
+      else if (completion->priv->current_selected < matches)
         {
           gtk_tree_selection_unselect_all (gtk_tree_view_get_selection (GTK_TREE_VIEW (completion->priv->action_view)));
 
index 73f642189f9d2f157e7ad4a665a0b2ebb787dafc..74eacfdae600fdf3eb2714f75c4d6a3594c3e7b4 100644 (file)
@@ -1040,8 +1040,6 @@ _gtk_entry_completion_popup (GtkEntryCompletion *completion)
   if (GTK_WIDGET_MAPPED (completion->priv->popup_window))
     return;
 
-  completion->priv->first_sel_changed = TRUE;
-
   gtk_widget_show_all (completion->priv->vbox);
 
   gdk_window_get_origin (completion->priv->entry->window, &x, &y);